# -*- encoding=utf8 -*-
__author__ = "Bryan.Chen"

from airtest.core.api import *

auto_setup(__file__)

from poco.drivers.std import StdPoco
poco = StdPoco()

class TCSSwitchServer:

    def __init__(self):
        print("%s __init__" % (__file__))
    
    def runTest(self, args):
        btnLocalIPList = poco("local_btnstate")
        if not btnLocalIPList:
            # 非切服界面
            return True
        
        btnTestEnv = poco("localip_listview").child("ip_item_model")[0];
        if not btnTestEnv:
            return True 
        
        btnTestEnv.click([0.5, 0.5])
        
        btnStart = poco("start_btn_center")
        if not btnStart:
            return True 
        
        btnStart.click([0.5, 0.5]) # 进入测试服环境
        
        return True
    
_instance = TCSSwitchServer()
runTest = _instance.runTest